#ifndef _BIT_ARRAY_H_
#define _BIT_ARRAY_H_


#include "../bitpointer/BitPointer.h"
#include "../memory/Memory.h"


/*
	class : BitArray
	desc : This is an interface for packing data
		into bits while ignoring the actual size
		needed to be allocated for doing the packing
		itself. So it relives you of having to deal
		with that.
*/
class BitArray
{
	private :
		//the starting address of the data I want to pack.
		volatile void* data;
		//tells me how many bits I really want to index through
		unsigned long int numberOfBits;
		//tells me the size of data that is allocated.
		unsigned long int length;
		//tells me if this data is allocated.
		unsigned char allocated;
	public :
		//default constructor for bitarray
		BitArray();
		//constructor allocates data based on how many bits
		//I want to iterate through.
		BitArray(unsigned long int bitNumber);
		//constructor sets data to pointer based in and the 
		//size to the length passed in and then computes
		//maximum number of bits I can iterate through given this.
		BitArray(void* pointer, unsigned long int length);
		//sets the number of bits iterated through to bit
		//but checks if it doesn't go over the total amount of data
		void setBitNumber(unsigned long int bit);
		//returns the size 
		unsigned long int size();
		//gets a bit pointer to given bit in the array.
		BitPointer getBit(unsigned long int bit);
		//operator for indexing through bits.
		BitPointer operator[](unsigned long int bit);
		//set byte data
		void setByte(unsigned char value, unsigned char index);
		//get byte data
		unsigned char getByte(unsigned char index);

		//destructor for the bit array
		~BitArray();

		//copy constructor
		BitArray(const BitArray& array);
		//assignment operator.
		BitArray& operator=(const BitArray& array);
};



#endif
